//package com.sinothk.hussars.controller;
//
//
//import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
//import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
//import com.sinothk.hussars.entity.RoleEntity;
//import com.sinothk.hussars.entity.UserEntity;
//import com.sinothk.hussars.entity.WorkerEntity;
//import com.sinothk.hussars.service.RoleService;
//import com.sinothk.hussars.service.WorkerService;
//import com.sinothk.server.support.annotation.callback.BizException;
//import com.sinothk.server.support.annotation.callback.ResponseResult;
//import com.sinothk.server.support.entity.ResultCode;
//import com.sinothk.server.support.utils.StringUtil;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//import org.springframework.web.bind.annotation.PostMapping;
//import org.springframework.web.bind.annotation.RequestBody;
//import org.springframework.web.bind.annotation.RequestMapping;
//
//import org.springframework.web.bind.annotation.RestController;
//import com.sinothk.hussars.base.BaseController;
//
///**
// * <p>
// * 角色表 前端控制器
// * </p>
// *
// * @author liangyt
// * @since 2021-01-02
// */
//@Api(tags = "角色相关功能")
//@RestController
//@RequestMapping("/role")
//@ResponseResult()
//public class RoleController extends BaseController {
//
//    private final RoleService roleService;
//
//    public RoleController(RoleService roleService) {
//        this.roleService = roleService;
//    }
//
//    @ApiOperation(value = "新增角色")
//    @PostMapping("/save")
//    public RoleEntity save(@RequestBody RoleEntity roleEntity) {
//        // 参数验证
//        if (StringUtil.isEmpty(roleEntity.getRoleCode())) throw new BizException("角色编码不能为空");
//        // 存在验证
//        LambdaQueryWrapper<RoleEntity> queryWrapper = new LambdaQueryWrapper<>();
//        queryWrapper.eq(RoleEntity::getRoleCode, roleEntity.getRoleCode());
//        RoleEntity dbRole = roleService.getOne(queryWrapper);
//        if (dbRole != null) throw new BizException("角色已存在");
//        // 保存
//        roleService.save(roleEntity);
//        return roleEntity;
//    }
//}
//
